package com.lin.threadtest;
/**
 * 多线程继承Thread类
 * @author Zhang
 *
 */
public class ThreadTest extends Thread{
	private String name;
	public ThreadTest(String name) {
		this.name = name;
	}
	public void run(){
		for (int i = 1; i <= 3; i++) {
			
			int num = (int)(Math.random()*10);
			System.out.println(name+"-第"+i+"次运行-"+"sleep:"+num);
			try {
				sleep(num*1000);
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
	}
	
	public static void main(String[] args) {
		new ThreadTest("线程1").start();
		new ThreadTest("线程2").start();
	}
}
